﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:m="clr-namespace:MetroWPF.Controls">
    <Style TargetType="{x:Type m:ProgressBar}">
        <Setter Property="Foreground" Value="{DynamicResource ProgressBarForegroundThemeBrush}"/>
        <Setter Property="Background" Value="{DynamicResource ProgressBarBackgroundThemeBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ProgressBarBorderThemeBrush}"/>
        <Setter Property="BorderThickness" Value="{DynamicResource ProgressBarBorderThemeThickness}"/>
        <Setter Property="Maximum" Value="100"/>
        <Setter Property="MinHeight" Value="{DynamicResource ProgressBarThemeMinHeight}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type m:ProgressBar}">
                    <Grid x:Name="TemplateRoot">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Determinate"/>
                                <VisualState x:Name="Indeterminate">
                                    <!--<Storyboard RepeatBehavior="Forever">
                                        <DoubleAnimation Duration="0:0:3.917" From="{Binding ContainerAnimationStartPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"  Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="EllipseGrid"/>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E1">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:1" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:3" Value="{Binding EllipseAnimationEndPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E2">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:1.167" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:3.167" Value="{Binding EllipseAnimationEndPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E3">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:1.333" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:3.333" Value="{Binding EllipseAnimationEndPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E4">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:1.5" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:3.5" Value="{Binding EllipseAnimationEndPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E5">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:1.667" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="{Binding EllipseAnimationWellPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                            <SplineDoubleKeyFrame KeySpline="0.4,0,0.6,1" KeyTime="0:0:3.667" Value="{Binding EllipseAnimationEndPositionTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B1">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-50"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3" Value="100"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B2">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-50"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="100"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B3">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-50"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.833" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="100"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B4">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-50"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="100"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B5">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="-50"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:1.167" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="100"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="EllipseGrid"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="E1">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{DynamicResource ProgressBarIndeterminateForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="E2">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{DynamicResource ProgressBarIndeterminateForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="E3">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{DynamicResource ProgressBarIndeterminateForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="E4">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{DynamicResource ProgressBarIndeterminateForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="E5">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{DynamicResource ProgressBarIndeterminateForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        --><!--<FadeOutThemeAnimation TargetName="DeterminateRoot"/>--><!--
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Indicator"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="backgroundBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="Transparent"/>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E1">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E2">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E3">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E4">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E5">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="1"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>-->
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="backgroundBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                        <Grid x:Name="EllipseGrid" Opacity="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RenderTransform>
                                <TranslateTransform/>
                            </Grid.RenderTransform>
                            <Border x:Name="B1" Grid.Column="8" RenderTransformOrigin="0.5,0.5">
                                <Border.RenderTransform>
                                    <TranslateTransform/>
                                </Border.RenderTransform>
                                <Ellipse x:Name="E1" Fill="{TemplateBinding Foreground}" Height="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}" RenderTransformOrigin="0.5,0.5" Width="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}">
                                    <Ellipse.RenderTransform>
                                        <TranslateTransform/>
                                    </Ellipse.RenderTransform>
                                </Ellipse>
                            </Border>
                            <Rectangle Grid.Column="7" Width="{Binding EllipseOffsetTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                            <Border x:Name="B2" Grid.Column="6" RenderTransformOrigin="0.5,0.5">
                                <Border.RenderTransform>
                                    <TranslateTransform/>
                                </Border.RenderTransform>
                                <Ellipse x:Name="E2" Fill="{TemplateBinding Foreground}" Height="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}" RenderTransformOrigin="0.5,0.5" Width="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}">
                                    <Ellipse.RenderTransform>
                                        <TranslateTransform/>
                                    </Ellipse.RenderTransform>
                                </Ellipse>
                            </Border>
                            <Rectangle Grid.Column="5" Width="{Binding EllipseOffsetTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                            <Border x:Name="B3" Grid.Column="4" RenderTransformOrigin="0.5,0.5">
                                <Border.RenderTransform>
                                    <TranslateTransform/>
                                </Border.RenderTransform>
                                <Ellipse x:Name="E3" Fill="{TemplateBinding Foreground}" Height="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}" RenderTransformOrigin="0.5,0.5" Width="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}">
                                    <Ellipse.RenderTransform>
                                        <TranslateTransform/>
                                    </Ellipse.RenderTransform>
                                </Ellipse>
                            </Border>
                            <Rectangle Grid.Column="3" Width="{Binding EllipseOffsetTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                            <Border x:Name="B4" Grid.Column="2" RenderTransformOrigin="0.5,0.5">
                                <Border.RenderTransform>
                                    <TranslateTransform/>
                                </Border.RenderTransform>
                                <Ellipse x:Name="E4" Fill="{TemplateBinding Foreground}" Height="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}" RenderTransformOrigin="0.5,0.5" Width="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}">
                                    <Ellipse.RenderTransform>
                                        <TranslateTransform/>
                                    </Ellipse.RenderTransform>
                                </Ellipse>
                            </Border>
                            <Rectangle Grid.Column="1" Width="{Binding EllipseOffsetTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
                            <Border x:Name="B5" Grid.Column="0" RenderTransformOrigin="0.5,0.5">
                                <Border.RenderTransform>
                                    <TranslateTransform/>
                                </Border.RenderTransform>
                                <Ellipse x:Name="E5" Fill="{TemplateBinding Foreground}" Height="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}" RenderTransformOrigin="0.5,0.5" Width="{Binding EllipseDiameterTemplateSetting, RelativeSource={RelativeSource Mode=TemplatedParent}}">
                                    <Ellipse.RenderTransform>
                                        <TranslateTransform/>
                                    </Ellipse.RenderTransform>
                                </Ellipse>
                            </Border>
                        </Grid>
                        <Rectangle x:Name="PART_Track"/>
                        <Grid x:Name="PART_Indicator" ClipToBounds="true" HorizontalAlignment="Left">
                            <Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="LayoutTransform" TargetName="TemplateRoot">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsIndeterminate" Value="true">
                            <Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>